/*
===========================================================================
Copyright (C) 2005 Sarunas

This file is part of MyPIRC source code.

DisksDB source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.

DisksDB source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with DisksDB; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
===========================================================================
*/
namespace MyIRC
{
	/// <summary>
	/// Represents person in channel
	/// coantains its nickname and flags
	/// </summary>
	public class ChannelNick
	{
		private string name		= null;
		public bool voice		= false;
		public bool oper		= false;
		public bool halfop	= false;

		/// <summary>
		/// Constructs ChannelNick object
		/// </summary>
		/// <param name="name">NickName</param>
		public ChannelNick(string name)
		{
			this.name = name;
		}

		/// <summary>
		/// Gets NickName
		/// </summary>
		public string Name
		{
			get
			{
				return this.name;
			}
			set
			{
				this.name = value;
			}
		}

		/// <summary>
		/// Returns if user has voice flag
		/// </summary>
		public bool Voice
		{
			get
			{
				return this.voice;
			}

		}

		/// <summary>
		/// Returns if user has op
		/// </summary>
		public bool Oper
		{
			get
			{
				return this.oper;
			}
		}

		/// <summary>
		/// Return if user has halfop
		/// </summary>
		public bool HalfOp
		{
			get
			{
				return this.halfop;
			}
		}

		/// <summary>
		/// Returns NicName + flags
		/// </summary>
		/// <returns>NickName with flags</returns>
		public override string ToString()
		{
			string flag = "";

			if (oper)
			{
				flag = "@";
			} 
			else if (halfop)
			{
				flag = "%";
			} 
			else if (voice)
			{
				flag = "+";
			}

			return flag + this.name;
		}
	}
}
